﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ShapeExer
{
    internal class Triangle:IShape
    {
        double x, y, z;//三条边
        double area;//面积

        public Triangle(double x, double y, double z)
        {
            this.x = x;
            this.y = y;
            this.z = z;
        }


        public double Area//面积属性
        { 
            get
            {
                double p = (x + y + z) / 2;
                //S=（△）=√[p(p-a)(p-b)(p-c)] 海伦公式
                return Math.Sqrt(p * (p - x) * (p - y) * (p - z));
            }
            set
            {
                area = value;
            }
        }
        public bool isArealegal()//判断形状是否合法
        {
            if (Area > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
